import http from '@/util/http.js'

// 根据状态获取用户的订单列表
export const getUserOrderList = function(params, handler) {
	http({
		url: '/order/getUserOrders',
		data: params,
		success: handler
	})
}

// 更新订单状态
export const updateOrderStatus = function(params, handler) {
	http({
		url: '/order/updateOrderStatus',
		data: params,
		success: handler
	})
}

// 根据订单id 查询订单信息
export const getUserOrder = function(params, handler) {
	http({
		url: '/order/getUserOrder',
		data: params,
		success: handler
	})
}

// 在订单里使用优惠券
export const useCouponInOrder = function (params, handler) {
	http({
		url: '/order/useCouponInOrder',
		data: params,
		success: handler
	})
}

// 付款
export const payBill = function (params, handler) {
	http({
		url: '/order/payBill',
		data: params,
		success: handler
	})
}

// 取消子订单
export const cancleOrderItem = function (params, handler) {
	updateOrderStatus(params, handler)
}

// 再来一单
export const oneMore = function (params, handler) {
	http({
		url: '/order/oneMore',
		data: params,
		success: handler
	})
}